<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2019/10/30
 * Time: 10:23
 */

namespace App\Model;


use Illuminate\Database\Eloquent\SoftDeletes;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements JWTSubject
{

    use SoftDeletes,Notifiable;

    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }

    protected $primaryKey = 'user_id';

    protected $dates = [
        'created_at', 'updated_at'
    ];

    protected $casts = [
        'album' => 'array'
    ];

    protected $hidden = [
        'password'
    ];

    public function user_info()
    {
        return $this->hasOne(UserInfo::class, 'user_id', 'user_id');
    }

    public function locations()
    {
        return $this->hasMany(Location::class, 'user_id', 'user_id');
    }

}